home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / src / syswait.h < prev    next >
C/C++ Source or Header  |  1997-03-07  |  2KB  |  80 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. #if !defined (octave_syswait_h)
  24. #define octave_syswait_h 1
  25.  
  26. // This mess suggested by the autoconf manual.
  27.  
  28. #ifdef HAVE_SYS_TYPES_H
  29. #include <sys/types.h>
  30. #endif
  31.  
  32. #if defined (NeXT) && ! defined (_POSIX_SOURCE)
  33. #define HAVE_SYS_WAIT_H
  34. #endif
  35.  
  36. #if defined HAVE_SYS_WAIT_H
  37. #include <sys/wait.h>
  38. #endif
  39.  
  40. #if defined (NeXT)
  41. #define HAVE_WAITPID 1
  42. #define waitpid(a, b, c) \
  43.   wait4 ((a) == -1 ? 0 : (a), (union wait *)(b), c, 0)
  44.  
  45. // Use the defaults below
  46. #undef WIFEXITED
  47. #undef WEXITSTATUS
  48. #undef WIFSIGNALLED
  49. #endif
  50.  
  51. // NeXT has sys/wait.h, but it is not compatible with POSIX.1, so we
  52. // try to define waitpid in terms of wait4.
  53.  
  54. #if defined (NeXT)
  55. #include <sys/wait.h>
  56. #define waitpid(a, b, c) \
  57.   wait4 ((a) == -1 ? 0 : (a), (union wait *)(b), c, 0)
  58. #endif
  59.  
  60. #ifndef WIFEXITED
  61. #define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
  62. #endif
  63.  
  64. #ifndef WEXITSTATUS
  65. #define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
  66. #endif
  67.  
  68. #ifndef WIFSIGNALLED
  69. #define WIFSIGNALLED(stat_val) \
  70.   (((stat_val) & 0177) != 0177 && ((stat_val) & 0177) != 0)
  71. #endif
  72.  
  73. #endif
  74.  
  75. /*
  76. ;;; Local Variables: ***
  77. ;;; mode: C++ ***
  78. ;;; End: ***
  79. */
  80.